package dhy.com.quarz;

import dhy.com.clawer.ClawerProperties;
import dhy.com.utils.FileUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

//每天晚上十二点，定时清除所有垃圾文件
@Component
public class Cleaner
{
    @Resource
    private ClawerProperties clawerProperties;

    @Scheduled(cron="0 0 0 * * ?")
    public void cronJob()
    {
         //删除所有爬取文件
        String filePathPrefix = clawerProperties.getFilePathPrefix();
        FileUtils.delFile(filePathPrefix);
    }
}
